/*    */ package com.jcrj.service;
/*    */ 
/*    */ import com.jcrj.dao.RoleDao;
/*    */ import com.jcrj.entity.ORole;
/*    */ import java.util.List;
/*    */ 
/*    */ public class RoleService
/*    */ {
/*    */   private RoleDao roleDao;
/*    */ 
/*    */   public RoleDao getRoleDao()
/*    */   {
/* 13 */     return this.roleDao;
/*    */   }
/*    */ 
/*    */   public void setRoleDao(RoleDao roleDao) {
/* 17 */     this.roleDao = roleDao;
/*    */   }
/*    */ 
/*    */   public void saveRole(ORole role) {
/* 21 */     this.roleDao.saveRole(role);
/*    */   }
/*    */ 
/*    */   public void updateRole(ORole role) {
/* 25 */     this.roleDao.updateRole(role);
/*    */   }
/*    */   public void deleteRole(ORole role) {
/* 28 */     this.roleDao.deleteRole(role);
/*    */   }
/*    */   public ORole getRoleInfo(int id) {
/* 31 */     return (ORole)this.roleDao.getObject(new ORole(), id);
/*    */   }
/*    */   public List<ORole> getRoleList(String name, int currentPage) {
/* 34 */     String hql = "from ORole o ";
/* 35 */     if ((name != null) && (!"".equals(name.trim()))) {
/* 36 */       hql = hql + "  where  o.name like '%" + name.trim() + "%'";
/*    */     }
/* 38 */     return this.roleDao.findByPage(hql, currentPage);
/*    */   }
/*    */ 
/*    */   public Long getRoleCount(String name) {
/* 42 */     String hql = "select count(id) from ORole o";
/* 43 */     if ((name != null) && (!"".equals(name.trim()))) {
/* 44 */       hql = hql + "  where  o.name like '%" + name.trim() + "%'";
/*    */     }
/* 46 */     return this.roleDao.countTotalByHql(hql);
/*    */   }
/*    */ 
/*    */   public List<ORole> findAllRole() {
/* 50 */     String hql = "from ORole";
/* 51 */     return this.roleDao.findByHql(hql);
/*    */   }
/*    */ 
/*    */   public void deleteRole(String[] ids) {
/* 55 */     if (ids != null) {
/* 56 */       String id = "";
/* 57 */       for (int i = 0; i < ids.length; i++) {
/* 58 */         if (id == "")
/* 59 */           id = id + ids[i];
/*    */         else {
/* 61 */           id = id + "," + ids[i];
/*    */         }
/*    */       }
/* 64 */       String hql = "delete from ORole where id in(" + id + ")";
/* 65 */       this.roleDao.executeHql(hql);
/*    */     }
/*    */   }
/*    */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     com.jcrj.service.RoleService
 * JD-Core Version:    0.6.0
 */